package com.vpen.springsecuritytest.service.impl;

import com.vpen.springsecuritytest.mapper.UserMapper;
import com.vpen.springsecuritytest.pojo.User;
import com.vpen.springsecuritytest.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * -@Version 1.0
 * -@Author:Vpen
 * -@Date:2021/3/13 19:43
 * -@Content:
 */

@Service(value = "userSI")
public class UserServiceImpl implements UserService {
    @Resource(name = "userMapper")
    UserMapper userMapper;
    /**
     * 作者: Vpen
     * 描述: 验证登录
     * */
    @Override
    public User login(String name) {
        return userMapper.selectUserByUserName(name);
    }
    /**
     * 作者:Vpen
     * 描述: 获取用户角色
     * */
    @Override
    public List<String> selectRoleByUser(User user) {
        return userMapper.selectRoleByUserId(user.getId());
    }
    /**
     * 作者:Vpen
     * 描述: 获取用户资源
     * */
    @Override
    public List<String> selectResourceByUser(User user) {
        return userMapper.selectResourceByUserId(user.getId());
    }
}
